<template>
  <a-modal
    v-model="visible"
    title="选择服务"
    ok-text="确认"
    cancel-text="取消"
    @cancel="visible = false"
    @ok="OK"
  >
  <a-select @select="onSelected"   style="width:200px">
      <a-select-option 
      v-for="item in services" :key="item.identifier" :value="item.identifier">
          {{item.name}}
      </a-select-option>
  </a-select>

  </a-modal>
</template>
<script>
export default {
    props:['mbody'],
    computed:{
        services(){
            if(this.mbody && this.mbody.services){
                return this.mbody.services
            }
            return []
        }
    },
    data(){
        return {
            visible:false,
            owner:null,
            callback:null,
            sel:null,
            selValue:[],
        }
    },
    methods: {
        Show(callback,owner){
            this.callback = callback
            this.owner = owner
            this.selValue = []
            this.visible = true
        },
        OK(){
            if(this.callback && this.owner){
                this.callback(this,this.owner)
                this.visible = false
            }
        },
        onSelected(value){
            this.sel = value
        }
    },
}
</script>